﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Input;

namespace CollisionDetectionSandbox
{
    class HowToScreen : Screen
    {
        Texture2D mHowToScreenBackground;
        Button mBackButton, mBackHover;

        

         public HowToScreen(ContentManager theContent, EventHandler theScreenEvent)
            : base(theScreenEvent)
        {
            //Load the background texture for the screen
            mHowToScreenBackground = theContent.Load<Texture2D>("Main Textures/HowToScreenEdit");
            mBackButton = new Button(theContent, "ButtonTextures/button_menu2", ZeusGame.xpos, ZeusGame.ypos + 250);
            mBackHover = new Button(theContent, "ButtonTextures/buttonhover_menu2", ZeusGame.xpos, ZeusGame.ypos + 250);
        }

        public override void Update(GameTime theTime)
        {            
            MouseState state = Mouse.GetState();
            int mx = state.X;
            int my = state.Y;
            if (state.LeftButton == ButtonState.Pressed)
            {
                if (mBackButton.hit_image(mx, my))
                {
                    ScreenEvent.Invoke(this, new EventArgs());
                }
            }
            base.Update(theTime);
        }

        public override void Draw(SpriteBatch theBatch)
        {
            MouseState state = Mouse.GetState();
            int mx = state.X;
            int my = state.Y;
            theBatch.Draw(mHowToScreenBackground, Vector2.Zero, Color.White);

            if (mBackButton.hit_image(mx, my))
            {
                mBackHover.Draw(theBatch);
            }
            else mBackButton.Draw(theBatch);

            base.Draw(theBatch);
        }
    }
}
